<template>
  <div>
    <h2 ref="title">hello world</h2>
  </div>
</template>

<script>
import { ref, watchEffect } from 'vue'
export default {
  setup () {
    const title =ref(null)
    // console.log(title.value);


    watchEffect(()=>{
      console.log(title.value);
    }
    ,{flush:'pre'}) //post(页面加载完毕再执行) ,pre(默认),sync
    // setTimeout(()=>{
    //   console.log(title.value);
    // },1000)
    return {
      title
    }
  }
}
</script>

<style lang="scss" scoped>

</style>